import { reqCategoryList, reqGetBannerList, reqFloorList } from "@/api";

const state = {
  cateGoryList: [], // home 仓库中存储三级菜单的数据
  bannerList: [], // 轮播图的数据
  floorList: [], //floor组件数据
  // test: 0
};
const mutations = {
  CATEGORYLIST(state, value) {
    state.cateGoryList = value;
  },
  GETBANNERLIST(state, value) {
    state.bannerList = value;
  },
  GETFLOORLIST(state, value) {
    state.floorList = value;
  },
  /*TEST(state, value) {
              state.test = value
          }*/
};
const actions = {
  async categoryList(context) {
    let result = await reqCategoryList();
    if (result.code == 200) {
      context.commit("CATEGORYLIST", result.data);
    }
  },
  async getBannerList(context) {
    let result = await reqGetBannerList();
    if (result.code == 200) {
      context.commit("GETBANNERLIST", result);
    }
  },
  async getFloorList(context) {
    let result = await reqFloorList();
    if (result.code == 200) {
      context.commit("GETFLOORLIST", result);
    }
  },
  /*test(context) {
              let t=666
              context.commit('TEST',t)
          }*/
};
const getters = {};

export default {
  state,
  mutations,
  actions,
  getters,
};
